# coding=UTF-8
import sqlite3,subprocess,requests,json


p = subprocess.Popen(['adb', 'shell', 'getprop', '|', 'grep', 'product'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
output, err = p.communicate()

# 输出短信内容
if output:
	# print("短信内容:")
	# print(output.decode('utf-8'))
	sys_data=output.decode('utf-8')
else:
	pass
	# print("读取失败:", err.decode('utf-8'))

site=open("config.json","r")
site=site.read()
site=json.loads(site)
data={"s":sys_data}
url=f"{site['site']}/sys.php"
r=requests.post(url=url,data=data)
r=json.loads(r.text)

rs=json.dumps(r)

connect=sqlite3.connect('data/sms.db')


cursor=connect.cursor()




	

sql=f"update sys set [values]='{rs}' where id=1"
cursor.execute(sql)
connect.commit()

# print("执行成功")


cursor.close()

connect.close()
